package com.wuming.house.service;

import com.wuming.house.core.BusinessException;
import com.wuming.house.model.WeixinUser;

import java.util.List;

public interface WeixinUserService {

    /**
     * 保存微信用户
     *
     * @param user
     * @throws BusinessException
     */
    void saveWeixinUser(WeixinUser user) throws BusinessException;

    /**
     * 更新微信用户
     *
     * @param user
     * @throws BusinessException
     */
    void modifyWeixinUser(WeixinUser user) throws BusinessException;

    /**
     * 根据用户标识查询微信用户
     *
     * @param skey
     * @param openId
     * @return
     * @throws BusinessException
     */
    WeixinUser getUserBySkey(String skey, String openId) throws BusinessException;

    /**
     * 根据时间查询用户总数
     *
     * @param startTime 开始时间
     * @param endTime   结束时间
     * @return 用戶总数
     * @throws BusinessException
     */
    int getTotalByTime(String startTime, String endTime) throws BusinessException;

    /**
     * 根据用户名和手机号查询微信用户
     *
     * @param name      用户名
     * @param mobile    手机号
     * @param pageIndex
     * @param pageSize
     * @return 微信用户
     */
    List<WeixinUser> getWeixinUserByPage(String name, String mobile, int pageIndex, int pageSize) throws BusinessException;

    /**
     * 查询总数
     *
     * @param name   用户名
     * @param mobile 手机号
     * @return
     */
    int getTotal(String name, String mobile) throws BusinessException;

    WeixinUser getUserByUserid(Long userid);
}
